package com.beiding.t;

import java.io.File;

/**
 * @author 丁常磊
 * @date 2022/4/26 8:31
 */

public class 清理无效打包文件 {
    public static void main(String[] args) {
        File file = new File("Functions:\\quanqudao1\\ocmomp-sdyz");
        for (File listFile : file.listFiles()) {
            File target = new File(listFile, "target");
            if (target.exists()) {
                deepClear(target);
                System.out.println(target);
            }
        }
    }

    private static void deepClear(File file) {
        if (file.isFile()) {
            file.delete();
        } else if (file.isDirectory()) {

            File[] listFiles = file.listFiles();
            if (listFiles != null) {
                for (File listFile : listFiles) {
                    deepClear(listFile);
                }
            }
            file.delete();

        }
    }

}
